package bank;

public class _104MaxDepth {
    static int res = 0;
    public static int maxDepth(TreeNode root) {
        dfs(root,0);
        return res;
    }

    private static void dfs(TreeNode root, int length) {
        if (root == null){
            res = Math.max(res,length);
            return;
        }
        dfs(root.left,length+1);
        dfs(root.right,length+1);
    }
}
